add_library(OpencvUnDistort STATIC opencv_undistort.cpp)

include_directories(${OpenCV_INCLUDE_DIRS})
include_directories(${EXTRA_INCLUDES})

set(EXTRA_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/ ${EXTRA_INCLUDES} PARENT_SCOPE)

target_include_directories(OpencvUnDistort PUBLIC ${CMAKE_SOURCE_DIR}/include ${EXTRA_INCLUDES})
target_include_directories(OpencvUnDistort PUBLIC ${OpenCV_INCLUDE_DIRS})


target_link_libraries(OpencvUnDistort PUBLIC yaml-cpp)
target_link_libraries(OpencvUnDistort PUBLIC spdlog::spdlog_header_only)
target_link_libraries(OpencvUnDistort PUBLIC ${OpenCV_LIBS})
target_link_directories(OpencvUnDistort PUBLIC ${EXTRA_LIBS})

set(EXTRA_LIBS OpencvUnDistort ${EXTRA_LIBS} PARENT_SCOPE)

add_executable(UnDistort opencv_undistort.cpp)

target_include_directories(UnDistort PUBLIC ${CMAKE_SOURCE_DIR}/include ${EXTRA_INCLUDES})
target_include_directories(UnDistort PUBLIC ${OpenCV_INCLUDE_DIRS})


target_link_libraries(UnDistort PUBLIC yaml-cpp)
target_link_libraries(UnDistort PUBLIC spdlog::spdlog_header_only)
target_link_libraries(UnDistort PUBLIC ${OpenCV_LIBS})
target_link_libraries(UnDistort PUBLIC ${EXTRA_LIBS})
target_link_directories(UnDistort PUBLIC ${EXTRA_LIBS})